package com.ordertracker.constant;

import com.ordertracker.util.Preconditions;

/**
 * Description of class.
 * Created 1/18/13 2:03 PM
 *
 * @author andrey.rodin@playtech.com
 */

public enum Sex implements GetByName<Sex>{
    MALE("MALE"),
    FEMALE("FEMALE"),
    UNKNOWN("UNKNOWN");

    private String name;

    private Sex(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public Sex getByName(String name) {
        Preconditions.<String>checkNull(name, "Sex: parameter=name must be not null!");
        for (Sex type : Sex.values()) {
            if (type.getName().equals(name))
                return type;
        }

        return null;
    }
}
